package com.yc.store.util;

import com.yc.store.biz.BizExeption;

import java.util.Collection;
import java.util.Map;

/**
 * Company 源辰信息
 *
 * @author navy
 * @date 2024/4/27
 * Email haijunzhou@hnit.edu.cn
 */
public class Utils {

    public static void check(boolean bool, String msg) throws BizExeption {
        if(bool){
            throw new BizExeption(msg);
        }
    }

    public static boolean isEmpty(Object object){
        if(object == null){
            return true;
        } else if(object instanceof String){
            return object.toString().trim().isEmpty();
        } else if(object instanceof Collection){
            return ((Collection)object).isEmpty();
        } else if(object instanceof Map){
            return ((Map)object).isEmpty();
        } else {
            return false;
        }
    }

}
